`timescale 1ns/1ns
`define HASH_WIDTH 1024 
`define DATA_WIDTH 256
`define SHA512_TEST		"UsLYQLDnOnDE7HK3RHTlfQT4KKojiu4ZsTbrnfeosxllhAUPi0oySqSUULJv70czlZkFTGPHVuO5UUX56fzylgChHQtLx2Mbn4iu3KB80VQHbVVq"
`define SHA512_TEST_PADDING	{1'b1,127'b0,896'b0,128'd896}	// 896 bit
`define SHA512_TEST_RESULT	256'hbafcc23a6714a8fd2d591fbcf8453e94e96163faecd5ae84f5471dde8bc7d4d2


module testtop_ecc_core;
reg clk,rst_n,curve_sel,Start;
wire Done;
reg [2:0] FunSel;
reg [`DATA_WIDTH-1:0] dA,PA_x,PA_y,/*G_x,G_y,*//*a,p,n,*/random_k,s_verify,r_verify,Hv_r;
wire [`DATA_WIDTH-1:0] s,r;
reg Hv_done;
reg [`HASH_WIDTH-1:0] sha512_M;
reg sha512_first_round,sha512_last_round,sha512_start;
wire bingo;
wire [2:0] State;
wire [7:0] error;
//reg [2047:0] all_message;

//top_ecc_core ecc(clk,rst_n,curve_sel,Start,Done,FunSel,dA,PA_x,PA_y,/*G_x,G_y,*//*a,p,n,*/random_k,s_verify,r_verify,s,r,sha512_M,sha512_first_round,sha512_last_round,sha512_start,bingo,State);

ecc_core ecc(
                .clk(clk),
                .rst_n(rst_n),
                .Start(Start),
                .Done(Done),
                .FunSel(FunSel),
                .curve_sel(curve_sel),
                .dA(dA),
                .PA_x(PA_x),
                .PA_y(PA_y),
                .random_k(random_k),
                .s_verify(s_verify),
                .r_verify(r_verify),
                .s(s),
                .r(r),
                .Hv_done(Hv_done),
                .Hv_r(Hv_r),
                .bingo(bingo),
                .State(State),
                .error(error)
            );

initial
begin
clk=0;
rst_n=1;
Start=0;
//sha512_start=1;
#20 rst_n=0;
#20 rst_n=1;
#20 Start=1;
#20 Start=0;
end

always #10 clk = ~clk;

initial
begin
curve_sel = 1'b1;
FunSel = 3'b000;
dA =256'h526ff0b75db2d94089fa76a1983db0340d79ff37acc58e214fae46a3c7dae211;
PA_x=256'h958e4164204f52f54ae3403223ee5f42e01ed9ebecbee98b04424cce1e7aabd4;
PA_y=256'hb3891de9bfb2f38f4f252c380590f206bda63306626b646c76c1d7d915d464f5;
random_k=256'h16a25a3d8e495e9efeeb31ce49e0f38e0d00828ef8b0c6b42b81145803f0b21f;
Hv_r    =256'hc7e8337eff9f56b15ebab1820051d05f687ed7f4aaef99cc3bb277eec2101fa2;
s_verify=256'h0;
r_verify=256'h0;
Hv_done = 1;

#20  
Start = 0;

end
/*
initial
begin
curve_sel = 1'b1;
FunSel   = 3'b001;
dA       =256'h526ff0b75db2d94089fa76a1983db0340d79ff37acc58e214fae46a3c7dae211;
PA_x     =256'h958e4164204f52f54ae3403223ee5f42e01ed9ebecbee98b04424cce1e7aabd4;
PA_y     =256'hb3891de9bfb2f38f4f252c380590f206bda63306626b646c76c1d7d915d464f5;
random_k =256'h16a25a3d8e495e9efeeb31ce49e0f38e0d00828ef8b0c6b42b81145803f0b21f;
Hv_r     =256'hc7e8337eff9f56b15ebab1820051d05f687ed7f4aaef99cc3bb277eec2101fa2;
s_verify = 256'h858cf447d59c34d738a317e6099b13176c1e93005006a6324358e40a1bae9c8a;
r_verify = 256'h3f61ed5d3f6de88ffac982df87657586034ca22b17e32d9dc98e3b4861fb8c3b;
Hv_done = 1;

#20
Start = 0;
end*/ 
endmodule

